
var actorallmessage = document.getElementById("actorallmessage");
var alltypes = document.getElementById("alltypes");
var hideworkstext = document.getElementById("hideworkstext");
var textliss = document.getElementById("text").querySelectorAll("li");
for (let i = 0; i < textliss.length;i++){
    textliss[i].onclick = function(){
        if (i == 0) {
            actorallmessage.style.display = "none";
            alltypes.style.display = "block";
            hideworkstext.style.display = "block";
            alldsjhidevideo.style.display = "none";
            alldyhidevideo.style.display = "none";
            allhidevideo.style.display = "none";
        } else {
            actorallmessage.style.display = "block";
            alltypes.style.display = "none";
            hideworkstext.style.display = "none";
            alldsjhidevideo.style.display = "none";
            alldyhidevideo.style.display = "none";
            allhidevideo.style.display = "none";
        }
        for (let i = 0; i < textliss.length; i++) {
            textliss[i].style.borderBottom = "";
            textliss[i].style.color = "";
        }
        textliss[i].style.borderBottom = "2px solid #00cc36";
        textliss[i].style.color = "#00cc36";
    }
}

/*作品分类分别展示！！！ */
// var hideworkstextlis = document.getElementById("hideworkstext").querySelectorAll("li");
// var dy = document.getElementById("dy");
// var dsj = document.getElementById("dsj");
// var zy = document.getElementById("zy");
// var dm = document.getElementById("dm");
// for (let i = 0; i < hideworkstextlis.length;i++){
//     hideworkstextlis[i].onclick = function(){
//             for (let i = 0; i < hideworkstextlis.length; i++) {
//                 hideworkstextlis[i].style.borderBottom = "";
//                 hideworkstextlis[i].style.color = "";
//             }
//             hideworkstextlis[i].style.borderBottom = "2px solid #00cc36";
//             hideworkstextlis[i].style.color = "#00cc36";

//             if(i==1){
//                 alltypes.style.display = "block";
//                 dy.style.display = "none";
//                 dsj.style.display = "block";
//                 zy.style.display = "none";
//                 dm.style.display = "none";
//                 hideworkstext.style.display = "block";
//             }else if(i==2){
//                 dy.style.display = "block";
//                 dsj.style.display ="none";
//                 zy.style.display = "none";
//                 dm.style.display = "none";
//             }else if(i==3){
//                 zy.style.display = "block";
//                 dsj.style.display = "none";
//                 dy.style.display = "none";
//                 dm.style.display = "none";
//             } else if (i == 0) {
//                 zy.style.display = "block";
//                 dsj.style.display = "block";
//                 dy.style.display = "block";
//                 dm.style.display = "block";
//             }else{
//                 dsj.style.display = "none";
//                 zy.style.display = "none";
//                 dy.style.display = "none";
//                 dm.style.display = "block";
//             }
//     }
// }







/*查看全部分别进入对应的div */

// for(let i =0 ; i<toall.length;i++){
//     toall[i].onclick = function(){
//         if (toall[i].style.display == "none"){
//             toall[i].style.display = "block"
//         }else{
//             toall[i].style.display = "none"
//         }
//         hideworkstextlis[0].style.borderBottom = "";
//         hideworkstextlis[0].style.color = "";
//         hideworkstextlis[i+1].style.borderBottom = "2px solid #00cc36";
//         hideworkstextlis[i+1].style.color = "#00cc36";
//         if(i==0){
//             alltypes.style.display = "block";
//             dy.style.display = "none";
//             dsj.style.display = "block";
//             zy.style.display = "none";
//             dm.style.display = "none";
//             hideworkstext.style.display = "block";
//         }else if(i==1){
//             alltypes.style.display = "block";
//             dy.style.display = "block";
//             dsj.style.display = "none";
//             zy.style.display = "none";
//             dm.style.display = "none";
//             hideworkstext.style.display = "block";
//         }else if(i==2){
//             alltypes.style.display = "block";
//             dy.style.display = "none";
//             dsj.style.display = "none";
//             zy.style.display = "block";
//             dm.style.display = "none";
//             hideworkstext.style.display = "block";
//         } else if (i == 3) {
//             alltypes.style.display = "block";
//             dy.style.display = "none";
//             dsj.style.display = "none";
//             zy.style.display = "none";
//             dm.style.display = "block";
//             hideworkstext.style.display = "block";
//         }else{
//             alltypes.style.display = "block";
//             dy.style.display = "block";
//             dsj.style.display = "block";
//             zy.style.display = "block";
//             dm.style.display = "block";
//             hideworkstext.style.display = "block";
//         }
//     }
// }












var accmplishment = document.getElementById("accmplishment")//演员个人经历
var actorName = document.getElementById("actorName")//演员姓名
var actorNickname = document.getElementById("actorNickname")//演员别名
var actorNation = document.getElementById("actorNation")//演员出生地
var actorBirthday = document.getElementById("actorBirthday")//演员出生日期
var actorOccupation = document.getElementById("actorOccupation")//演员职业
var test = window.location.href;
var numberId = test.split('?')[1]
var textlis = document.getElementById("hideworkstextul").querySelectorAll("li")
var allhidevideoul = document.getElementById("allhidevideoul");
var alldyhidevideo = document.getElementById("alldyhidevideo");
var alldyhidevideoul = document.getElementById("alldyhidevideoul");
/*全部电视剧视频 */
var dsjallvideo = document.getElementById("dsjallvideo");
var alldsjhidevideo = document.getElementById("alldsjhidevideo");
var alldsjhidevideoul = document.getElementById("alldsjhidevideoul");
var texts = document.getElementsByClassName("text");


axios({
    url: '/findActorMessage',
    method: 'get',
    params: {
        actorId: numberId
    }
})
    .then(function (data) {
        console.log(data)

        console.log(data.data.data.data.全部[0].videoList)/*演员的所有视频！！ */
        var allvideodiv = document.getElementById("allvideodiv");
        console.log(allvideodiv)
        /*五个全部视频 */
        for (let l = 0; l < 1; l++) {
            console.log(data.data.data.data.全部[0].videoList[l].videoPhoto)
            allvideodiv.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.全部[0].videoList[l].videoId}'}><img src='${data.data.data.data.全部[0].videoList[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.全部[0].videoList[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                    <span>${data.data.data.data.全部[0].videoList[l].videoYear}</span>
                    <span style="display:none;">${data.data.data.data.全部[0].videoList[l].videoId}</span>
                </p>
            </li>
        `
        }



        /*五个电影视频 */
        var dyallvideo = document.getElementById("dyallvideo");
        console.log(dyallvideo)


        console.log(data.data.data.data.电影)
        for (let l = 0; l < 0; l++) {
            dyallvideo.innerHTML += `
        
            <li>
                    <a href='/play?${data.data.data.data.电影[l].videoId}'}><img src='${data.data.data.data.电影[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电影[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                   
                    <span>${data.data.data.data.电影[l].videoYear}</span>
                    <span>${data.data.data.data.电影[l].videoId}</span>
                </p>
            </li>
        
        `
        }


        /*五个电视剧视频 */
        var dsjallvideo = document.getElementById("dsjallvideo");
        console.log(dsjallvideo)
        for (let l = 0; l < 1; l++) {
            dsjallvideo.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.电视剧[l].videoId}'}><img src='${data.data.data.data.电视剧[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电视剧[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                   
                    <span>${data.data.data.data.电视剧[l].videoYear}</span>
                    <span>${data.data.data.data.电视剧[l].videoId}</span>
                </p>
            </li>
        `
        }







        for (let i = 0; i < texts.length; i++) {
            // 点击标题进行切换内容
            texts[i].onclick = function () {
                for (let k = 0; k < texts.length; k++) {
                    texts[k].style.color = "#666"
                    textlis[k].style.borderBottom = ""

                }
                texts[i].style.color = "#00cc36"
                textlis[i].style.borderBottom = "2px solid #00cc36"


                if (i == 0) {
                    /*全部全部视频 */
                    alltypes.style.display = "none"
                    allhidevideo.style.display = "block"
                    alldyhidevideo.style.display = "none"
                    alldsjhidevideo.style.display = "none"
                    for (let l = 0; l < data.data.data.data.全部[0].videoList.length; l++) {
                        allhidevideoul.innerHTML += `
            <li>
                     <a href='/play?${data.data.data.data.全部[0].videoList[l].videoId}'}><img src='${data.data.data.data.全部[0].videoList[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.全部[0].videoList[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                    
                    <span>${data.data.data.data.全部[0].videoList[l].videoYear}</span>
                    <span>${data.data.data.data.全部[0].videoList[l].videoId}</span>
                </p>
            </li>
        `
                    }
                    /*全部 */
                } else if (i == 1) {
                    alltypes.style.display = "none"
                    /*全部电影视频 */
                    allhidevideo.style.display = "none"
                    alldyhidevideo.style.display = "block"
                    alldsjhidevideo.style.display = "none"
                    console.log(alldyhidevideo)
                    for (let l = 0; l < data.data.data.data.电影.length; l++) {
                        alldyhidevideoul.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.电影[l].videoId}'}><img src='${data.data.data.data.电影[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电影[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                   
                    <span>${data.data.data.data.电影[l].videoYear}</span>
                    <span>${data.data.data.data.电影[l].videoId}</span>
                </p>
            </li>
        `
                    }

                    /*电影 */
                } else {
                    alltypes.style.display = "none"
                    /*全部电视剧视频 */
                    allhidevideo.style.display = "none"
                    alldyhidevideo.style.display = "none"
                    alldsjhidevideo.style.display = "block"
                    for (let l = 0; l < data.data.data.data.电视剧.length; l++) {
                        alldsjhidevideoul.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.电视剧[l].videoId}'}><img src='${data.data.data.data.电视剧[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电视剧[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                    
                    <span>${data.data.data.data.电视剧[l].videoYear}</span>
                    <span>${data.data.data.data.电视剧[l].videoId}</span>
                </p>
            </li>
        `
                    }
                    /*电视剧 */
                }
            }
        }


        /*点击返回的时候刷新页面 */
        var back = document.getElementsByClassName("back");
        for (let i = 0; i < back.length; i++) {
            back[i].onclick = function () {
                window.location.reload()
            }
        }









        /*标题变色！！！ */
        var toall = document.getElementsByClassName("toall");
        var alltypes = document.getElementById("alltypes");
        for (let i = 0; i < toall.length; i++) {
            toall[i].onclick = function () {

                for (let k = 0; k < texts.length; k++) {
                    texts[k].style.color = "#666"
                    textlis[k].style.borderBottom = ""

                }
                texts[i].style.color = "#00cc36"
                textlis[i].style.borderBottom = "2px solid #00cc36"

                if (i == 0) {
                    /*全部全部视频 */
                    alltypes.style.display = "none"
                    allhidevideo.style.display = "block"
                    for (let l = 0; l < data.data.data.data.全部[0].videoList.length; l++) {
                        allhidevideoul.innerHTML += `
            <li>
                     <a href='/play?${data.data.data.data.全部[0].videoList[l].videoId}'}><img src='${data.data.data.data.全部[0].videoList[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.全部[0].videoList[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                    
                    <span>${data.data.data.data.全部[0].videoList[l].videoYear}</span>
                    <span>${data.data.data.data.全部[0].videoList[l].videoId}</span>
                </p>
            </li>
        `
                    }
                    /*全部 */
                } else if (i == 1) {
                    alltypes.style.display = "none"
                    /*全部电影视频 */
                    alldyhidevideo.style.display = "block"
                    for (let l = 0; l < data.data.data.data.电影.length; l++) {
                        alldyhidevideoul.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.电影[l].videoId}'}><img src='${data.data.data.data.电影[l].videoPhoto}'></a>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电影[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                   
                    <span>${data.data.data.data.电影[l].videoYear}</span>
                    <span>${data.data.data.data.电影[l].videoId}</span>
                </p>
            </li>
        `
                    }

                    /*电影 */
                } else {
                    alltypes.style.display = "none"
                    alldsjhidevideo.style.display = "block"
                    for (let l = 0; l < data.data.data.data.电视剧.length; l++) {
                        alldsjhidevideoul.innerHTML += `
            <li>
                    <a href='/play?${data.data.data.data.电视剧[l].videoId}'}><img src='${data.data.data.data.电视剧[l].videoPhoto}'>
                <p style="text-align: center;">
                    <span>${data.data.data.data.电视剧[l].videoName}</span>
                </p>
                <p style="text-align: center;">
                    
                    <span>${data.data.data.data.电视剧[l].videoYear}</span>
                    <span>${data.data.data.data.电视剧[l].videoId}</span>
                </p>
            </li>
        `
                    }
                    /*电视剧 */
                }

            }

        }

        console.log(data.data.data.data.全部[0])
        console.log("7777777777777777777")
        /*演员头像的遍历 */
        var actorimg = document.getElementById("actorimg");
        actorimg.src = `${data.data.data.data.全部[0].actorSrc}`
        console.log("9888888")
        var webactorName = document.getElementById("webactorName");
        var webactorIntroduction = document.getElementById("webactorIntroduction");
        var webactorId = document.getElementById("webactorId");
        /*演员信息的遍历！！！！ */
        webactorIntroduction.innerHTML = data.data.data.data.全部[0].actorIntroduction
        webactorName.innerHTML = data.data.data.data.全部[0].actorName
        webactorId.innerHTML = data.data.data.data.全部[0].actorId





        var accomplishment = document.getElementById("accomplishment");
        if (data.data.data.data.全部[0].accomplishment.length > 200) {
            var newaccomplishment = data.data.data.data.全部[0].accomplishment.substring(0, 200) + "...";
            console.log(newaccomplishment)

            accomplishment.innerHTML = newaccomplishment
            actorName.innerHTML = data.data.data.data.全部[0].actorName
            accmplishment.innerHTML = data.data.data.data.全部[0].actorIntroduction
            actorNickname.innerHTML = data.data.data.data.全部[0].actorNickname
            actorNation.innerHTML = data.data.data.data.全部[0].actorNation
            actorBirthday.innerHTML = data.data.data.data.全部[0].actorBirthday
            actorOccupation.innerHTML = data.data.data.data.全部[0].actorOccupation
        } else {
            accomplishment.innerHTML = data.data.data.data.全部[0].accomplishment
            accmplishment.innerHTML = data.data.data.data.全部[0].accomplishment
            actorName.innerHTML = data.data.data.data.全部[0].actorName
            accmplishment.innerHTML = data.data.data.data.全部[0].actorIntroduction
            actorNickname.innerHTML = data.data.data.data.全部[0].actorNickname
            actorNation.innerHTML = data.data.data.data.全部[0].actorNation
            actorBirthday.innerHTML = data.data.data.data.全部[0].actorBirthday
            actorOccupation.innerHTML = data.data.data.data.全部[0].actorOccupation
        }

        /*演员作品的遍历！！！！ */
        console.log(data.data.data.data.电视剧)
        /*进行电视剧的影视作品循环 */
        for (let i = 0; i < data.data.data.data.电视剧.length; i++) {

        }



    })
    .catch(function (error) {
        console.log(error)
        console.log('遍历演员信息失败')
    })